$(function () {
    findProductClassify();
})
function findProductClassify() {
    $.ajax({
        data:'',
        dataType:'json',
        type:'get',
        url:'/back/product/findProductClassify',
        success:function (data) {
            data=data.model;
            let html='';
            for (let i=0;i<data.length;i++){
                html +=' <option value="'+data[i].id+'">' + data[i].name + '</option>';
            };
            $("#productClassify").html(html);

        }
    })
}
function submit() {
    let data = new FormData();
    data.append("classify",$("#productClassify").val());
    data.append("name",$("#product-name").val());
    data.append("img",$("#product-img")[0].files[0]);
    data.append("content",$("#product-description").val());
    data.append("diliver",$("#diliver").val());
    data.append("averageprice",$("#averageprice").val());
    data.append("price",$("#price").val());
    data.append("quality",$("#quality").val());
    data.append("payment",$("#payment").val());
    data.append("information",$("#information").val());
    $.ajax({
        data: data,
        url:'/back/product/addProduct',
        dataType: 'json',
        type: 'post',
        contentType:false ,
        processData: false,
        success:function (data) {
            if (data.result==1){
                alert("添加成功");
            }else {
                alert("添加失败");
            };
        }
    })
}